{% extends "zato/index.html" %} {% load extras %} {% block html_title %}Service usage statistics{% endblock %} {% block "extra_css" %}
<link rel="stylesheet" type="text/css" href="/static/css/jquery.alerts.css"> {% endblock %} {% block "extra_js" %}

<script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.tablesorter.min.js"></script>
<script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.cookie.js"></script>
<script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.alerts.min.js"></script>
<script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/common.js"></script>

<script nonce="{{ CSP_NONCE }}">
    $.fn.zato.data_table.get_columns = function() {
        return [
            '_numbering',
            '_selection',

            'name',
            'item_usage_share',
            'item_time_share',

            'item_mean',
            'item_max',
            'item_min',

            'item_total_usage',
            'item_total_time',

        ]
    }
</script>

{% endblock %} {% block "content" %}
<h2 class="zato">Service usage statistics</h2>

{% if not zato_clusters %} {% include "zato/no-clusters.html" %} {% else %}

<div id="user-message-div" style='display:none'><pre id="user-message" class="user-message"></pre></div>

{% include "zato/search-form.html" with page_prompt="Show usage statistics"%} {% if cluster_id %}

<div id="markup">
    <table id="data-table">
        <thead>
            <tr class='ignore'>
                <th style="width:5%">&nbsp;</th>
                <th>&nbsp;</th>

                <th><a href="#">Name</a></th>
                <th><a href="#">Usage share</a> (%)</th>
                <th><a href="#">Time share</a> (%)</th>

                <th><a href="#">Mean</a> (ms)</th>
                <th><a href="#">Max</a> (ms)</th>
                <th><a href="#">Min</a> (ms)</th>

                <th><a href="#">Usage</a></th>
                <th><a href="#">Time spent</a></th>

        </thead>

        <tbody>
            {% if items %} {% for item in items %}
            <tr class="{% cycle 'odd' 'even' %}" id='tr_{{ item.id }}'>
                <td class='numbering'>&nbsp;</td>
                <td class="impexp"><input type="checkbox" /></td>

                <td><a href="{% url "service-overview" item.name %}?cluster={{ cluster_id }}">{{ item.name }}</a></td>
                <td>{{ item.item_usage_share|stats_float }}</td>
                <td>{{ item.item_time_share|stats_float }}</td>

                <td>{{ item.item_mean|stats_float }}</td>
                <td>{{ item.item_max|stats_float }}</td>
                <td>{{ item.item_min|stats_float }}</td>

                <td>{{ item.item_total_usage_human }}</td>
                <td>{{ item.item_total_time_human }}</td>

            </tr>
            {% endfor %} {% else %}
            <tr class='ignore'>
                <td colspan='10'>No results</td>
            </tr>
            {% endif %}

        </tbody>
    </table>
</div>

{% include "zato/paginate/action-panel.html" %} {% endif %} {% comment %}cluster_id{% endcomment %} {% endif %}{% comment %}not zato_clusters{% endcomment %} {% endblock %}
